from django import template

register = template.Library()

@register.filter(name="rev")
def do_mine(val):
    return val[::-1]


@register.filter(name="fmtphone")
def do_mine(val):
    return '%s-%s-%s' % (val[:3], val[3:7], val[7:])


@register.simple_tag
def errmsg(errlist):
    if errlist:
        return errlist[0]
    else:
        return ''
